﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Infrastructure.Crosscutting.Authorize
{
    /// <summary>
    /// 
    /// </summary>
    public interface IUserService
    {
        #region delete

        /// <summary>
        /// Deletes the user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool Delete(Domain.Entity.User user, Domain.Entity.User operUser);
        /// <summary>
        /// Deletes the user true.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteTrue(Domain.Entity.User user, Domain.Entity.User operUser);
        
        bool Delete(IList<int> idList, Domain.Entity.User operUser);

        bool DeleteTrue(IList<int> idList, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the user by id.
        /// 只设置为不可用
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteById(int id, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the name of the user by.
        /// 只设置为不可用
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteByName(string name, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the name of the user by.
        /// 只设置为不可用
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteByEmail(string email, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the name of the user by.
        /// 只设置为不可用
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteByUserGuid(string guid, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the user true by id.
        /// 物理删除
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteTrueById(int id, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the name of the user true by.
        /// 物理删除
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteTrueByName(string name, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the name of the user true by.
        /// 物理删除
        /// </summary>
        /// <param name="email">The email.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteTrueByEmail(string email, Domain.Entity.User operUser);

        /// <summary>
        /// Deletes the name of the user true by.
        /// 物理删除
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool DeleteTrueByGuid(string guid, Domain.Entity.User operUser);

        #endregion

        #region exist user

        /// <summary>
        /// Gets the user model by user name and PWD.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="pwd">The PWD.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelByUserNameAndPwd(string name, string pwd);

        /// <summary>
        /// Exists the name of the user by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        bool ExistUserByName(string name);


        /// <summary>
        /// Exists the name of the user by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        bool ExistUserByEmail(string email);

        /// <summary>
        /// Exists the user by QQ.
        /// </summary>
        /// <param name="qqId">The qq id.</param>
        /// <returns></returns>
        bool ExistUserByQQId(string qqId);

        /// <summary>
        /// Exists the user by sina.
        /// </summary>
        /// <param name="sinaId">The sina id.</param>
        /// <returns></returns>
        bool ExistUserBySinaId(string sinaId);

        /// <summary>
        /// Exists the user by name PWD.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="pwd">The PWD.</param>
        /// <param name="login">if set to <c>true</c> [login].</param>
        /// <returns></returns>
        bool ExistUserByNamePwd(string name, string pwd, bool login);

        /// <summary>
        /// Exists the user by name PWD no MD5.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="pwd">The PWD.</param>
        /// <returns></returns>
        bool ExistUserByNamePwdEncrypted(string name, string pwd);


        #endregion

        /// <summary>
        /// Gets the name of the user id by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        int GetUserIdByName(string name);

        /// <summary>
        /// Gets the user name by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        string GetUserNameById(int id);

        #region get user model

        /// <summary>
        /// Gets the name of the user model by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelByName(string name);

        /// <summary>
        /// Gets the name of the user model by.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelById(int id);

        /// <summary>
        /// Gets the user model by email.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelByEmail(string email);

        /// <summary>
        /// Gets the user model by QQ.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelByQQ(string qqId);

        /// <summary>
        /// Gets the user model by sina.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelBySina(string sinaId);

        /// <summary>
        /// Gets the user model by user GUID.
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <returns></returns>
        Domain.Entity.User GetUserModelByUserGuid(string guid);

        #endregion

        #region regster user

        /// <summary>
        /// Regsters the user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="userRole">The user role.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        Domain.Entity.User Add(Domain.Entity.User user, Domain.Entity.UserRole userRole, Domain.Entity.User operUser);

        #endregion

        #region change pwd

        /// <summary>
        /// Users the change PWD by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="pwd">The PWD.</param>
        /// <returns></returns>
        bool UserChangePwdById(int id, string pwd, Domain.Entity.User operUser);

        /// <summary>
        /// Users the name of the change PWD by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="pwd">The PWD.</param>
        /// <returns></returns>
        bool UserChangePwdByName(string name, string pwd, Domain.Entity.User operUser);

        #endregion

        #region update

        /// <summary>
        /// Updates the user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool Modify(Domain.Entity.User user, Domain.Entity.User operUser);

        /// <summary>
        /// Updates the user extension.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="operUser">The oper user.</param>
        /// <returns></returns>
        bool Modify(Domain.Entity.UserExtension user, Domain.Entity.User operUser);


        #endregion

        #region user extension

        /// <summary>
        /// Gets the user extension by user id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        Domain.Entity.UserExtension GetUserExtensionByUserId(int id);

        #endregion

        IQueryable<Domain.Entity.User> GetList();

        Domain.Entity.User GetDefautlOperUser();
    }
}
